package com.todo.event.activity.application.job;

import com.alibaba.fastjson.JSONObject;
import com.todo.common.utils.StringUtils;
import com.todo.event.activity.application.job.param.ActivityRewardParam;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author azhebuxing
 * @date 2025/1/16 17:51
 * @description
 */
@Slf4j
@Component
public class EventActivityRewardRetryJob {

    @XxlJob("eventActivityRewardRetryJob")
    public ReturnT<String> eventActivityRewardRetryJob(String param) {
//如果参数不为空，则根据参数做指定重试策略
        if (StringUtils.isNotBlank(param)){
            ActivityRewardParam activityRewardParam = JSONObject.parseObject(param, ActivityRewardParam.class);
            if (activityRewardParam == null){
                log.error("EventActivityRewardRetryJob param is failed check and retry again");
                return ReturnT.FAIL;
            }
        }

        //默认的重试步骤

        return ReturnT.SUCCESS;
    }
}
